package cn.tedu.util;

import java.util.Collections;
import java.util.LinkedList;

//测试 LinkedList
public class Test1_2 {
    public static void main(String[] args) {
        LinkedList<Integer> list=new LinkedList<>();
        Collections.addAll(list,1,2,2,3,5,6,4,8);
        System.out.println(list);
        System.out.println(list.get(0));
        list.addFirst(100);
        list.addLast(200);
        System.out.println(list);
        System.out.println(list.getFirst());
        System.out.println(list.getLast());
        System.out.println(list.removeFirst());
        System.out.println(list.removeLast());
        System.out.println(list.offerFirst(222));
        System.out.println(list.offerLast(000));
        System.out.println(list.pollFirst());
        System.out.println(list.pollLast());
    }
}
